﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;  
using XKPlatform.Service;
using Newtonsoft.Json.Linq;
using XKPlatform.DataModels.ReturnModel;


// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace XKPlatform.Controllers
{
    [Route("api/[controller]/[action]")]
    public class AuthenController : Controller
    {
        /// <summary>
        /// 获取角色列表
        /// </summary>
        /// <param name="sysToken"></param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public ResultModel GetAuthenRoleList(string sysToken)
        {
            ResultModel result = new AuthenService().GetRoleList(sysToken);
            return result;
        }


        /// <summary>
        /// 刷新系统SYSToken
        /// </summary>
        /// <returns></returns>
        //[HttpGet]
        //[AllowAnonymous]
        //public ResultModel refAuthenTokenInfo(string sysToken)
        //{
        //    ResultModel result = new AuthenService().refTokenInfo(sysToken);
        //    return result;
        //}

        /// <summary>
        /// 保存用户信息
        /// </summary>
        /// <param name="SaveTypeCode">提交类型</param>
        /// <param name="StrUserID">用户ID</param>
        /// <param name="RolesID">角色ID</param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public ResultModel SetUserState(string sysToken, string SaveTypeCode, string StrUserID, string RolesID)
        {
            ResultModel result = new AuthenService().GetResultModel(sysToken, SaveTypeCode, StrUserID, RolesID);
            return result;
        }

    }
}
